package com.zlp.exception.entity;

/**
 * @author: ZouLiPing
 * @date: 2018/10/10 17:52
 * @description: 错误码
 */
public class CodeMsg {

    private int status;
    private String msg;

    /**
     * 常见通用错误码
     */
    public static CodeMsg 请求成功 = new CodeMsg(0, "请求成功");
    public static CodeMsg 参数不正确 = new CodeMsg(400, "参数不正确");
    public static CodeMsg 需要登录 = new CodeMsg(401, "需要登录");
    public static CodeMsg 用户或密码错误 = new CodeMsg(401, "用户或密码错误");
    public static CodeMsg 密码错误 = new CodeMsg(401, "密码错误");
    public static CodeMsg 获取用户信息失败 = new CodeMsg(504, "获取用户信息失败");
    public static CodeMsg 传参解析错误 = new CodeMsg(402, "传参解析错误");
    public static CodeMsg 校验未通过 = new CodeMsg(403, "校验未通过");
    public static CodeMsg 必填参数不能为空 = new CodeMsg(406, "必填参数不能为空");
    public static CodeMsg 内部错误 = new CodeMsg(500, "内部错误");
    public static CodeMsg 保存失败 = new CodeMsg(501, "保存失败");



    /**
     * 30000 token解析相关
     */
    public static CodeMsg 解析token数据失败 = new CodeMsg(30000,"解析token数据失败");

    private CodeMsg(int status,String msg ) {
        this.status = status;
        this.msg = msg;
    }

    public static CodeMsg create(int status, String msg) {
        return new CodeMsg(status, msg);
    }

    public int getStatus() {
        return status;
    }

    public String getMsg() {
        return msg;
    }

}
